const BASE_URL = 'http://www.tangxiaoyang.vip:8082'

const http = options => {
	return new Promise((resolve,reject) => {
		uni.request({
			method:options.method || 'GET',
			url:BASE_URL + options.url,
			data:options.data || {},
			success: res => {
				if(res.data.status !== 0){
					return uni.showToast({
						title:'获取数据失败'
					})
				}
				resolve(res.data.message)
			},
			fail:err => {
				uni.showToast({
					title:'请求接口失败'
				})
				reject(err)
			}
		})
	})
}

export default http